<?php 
namespace app\common\model;

use think\Model;
use think\Db;

class ArticleEval extends Model
{
	protected function getCreateTimeAttr($v)
	{
		$time_len = time() - $v ;
		if($time_len < 10) {
			return '刚刚';
		} elseif ($time_len < 60) {
			return $time_len.'秒前';
		} elseif ($time_len >= 60 && $time_len < 3600) {
			return ceil(($time_len/60)).'分钟前';
		} else {
			return date('Y-m-d H:i:s',$v);
		}
	}
	
	protected function getReplyIdAttr($v){
		return Db::name('article_eval')->where(['id' => $v])->field('id,sender')->find();
	}
	protected function getContentAttr($v)
	{
		return strip_tags($v);
	}
	protected function getSenderAttr($v)
	{
		return strip_tags($v);
	}
	protected function getSenderWebAttr($v)
	{
		return strip_tags($v);
	}
	protected function getSenderEmailAttr($v)
	{
		return strip_tags($v);
	}
}